package itheima.com.testlistfragmentdemo;

import android.app.Application;
import android.content.Context;
import android.os.Handler;

import com.loopj.android.http.AsyncHttpClient;

import itheima.com.testlistfragmentdemo.net.ApiHttpClient;

/**
 * Created by Administrator on 2017/7/13 0013.
 */

public class MyApplication extends Application {
    private static Handler handler;
    private static Context context; //全局变量
    @Override
    public void onCreate() {
        handler=new Handler();
        context=getApplicationContext();
        //构建一个单一的网络请求框架的对象
        AsyncHttpClient asyncHttpClient=new AsyncHttpClient();
        //传递单列的AsyncHttpClient对象给代理类 ApiHttpClient
        ApiHttpClient.setHttpClient(asyncHttpClient);
    }

    public  static  Handler getHandler(){
        return  handler;
    }
    public  static  Context getContext(){
        return  context;
    }
}
